import fetch from 'utils/fetch';
/**
 * 考勤设备
 */
//查询设备类型详情
export function getDeviceInfo(fDeviceId,sManufactorId) {
    const data = {
        fDeviceId,
        sManufactorId
    };
    return fetch({
        url: 'device/getDeviceInfo',
        method: 'post',
        data
    });
  }
//根据设备类型id获取厂家集合
export function getManufactorById(fDeviceId) {
    const data = {
        fDeviceId,
    };
    return fetch({
        url: 'device/getManufactorById',
        method: 'post',
        data
    });
  }
//分页查询设备列表
export function findDeviceByPage(page,rows,sDeviceTypeId,fDeviceId,fSchoolId,sNumber,sPosition) {
    const data = {
        sDeviceTypeId,
        fDeviceId,
        fSchoolId,
        sNumber,
        sPosition
    };
    return fetch({
        url: 'device/findDeviceByPage/'+page+'/'+rows,
        method: 'post',
        data
    });
  }
//根据设备类别名称获取设备类别id
export function getClassIdByName(sName) {
    const data = {
        sName,
    };
    return fetch({
        url: 'device/getClassIdByName',
        method: 'post',
        data
    });
  }
//根据id获取设备类型，设备厂家信息
export function getTypeNameByClassId(pId) {
    const data = {
        pId,
    };
    return fetch({
        url: 'device/getTypeNameByClassId',
        method: 'post',
        data
    });
  }
//修改设备禁用状态
export function updateFlag(pId) {
    const data = {
        pId,
    };
    return fetch({
        url: 'device/updateFlag',
        method: 'post',
        data
    });
  }
//删除设备
export function deleteDevice(pId,fDeviceId,fSchoolId) {
    const data = {
        pId,
        fDeviceId,
        fSchoolId
    };
    return fetch({
        url: 'device/deleteDevice',
        method: 'post',
        data
    });
  }
//根据设备主键id获取设备详情
export function getDeviceById(pId) {
    const data = {
        pId,
    };
    return fetch({
        url: 'device/getDeviceById',
        method: 'post',
        data
    });
  }
//设备修改保存
export function updateDevice(pId,fSchoolId,fGrade,fClassId,sTip,sPosition) {
    const data = {
        pId,
        fSchoolId,
        fGrade,
        fClassId,
        sTip,
        sPosition
    };
    return fetch({
        url: 'device/updateDevice',
        method: 'post',
        data
    });
  }

//添加设备
export function saveDevice(fSchoolId,fGrade,fClassId,sNumber,fDeviceId,sDeviceName,sDeviceTypeId,sDeviceType,sManufactorId,sManufactor,sPosition,schoolCode,key) {
    const data = {
        fSchoolId,
        fGrade,
        fClassId,
        sNumber,
        fDeviceId,
        sDeviceName,
        sDeviceTypeId,
        sDeviceType,
        sManufactorId,
        sManufactor,
        sPosition,
        schoolCode,
        key
    };
    return fetch({
        url: 'device/saveDevice',
        method: 'post',
        data
    });
  }

//获取设备字典列表
export function getDictDeviceList(page,rows,classificationId,typeId) {
    const data = {
        classificationId,
        typeId
    };
    return fetch({
        url: 'device/findDictDevicePage/'+page+'/'+rows,
        method: 'post',
        data
    });
  }

//分页查询学校所有班级的绑定继电器列表
export function query(page,rows,schoolId,deviceId) {
    const data = {
        schoolId,
        deviceId
    };
    return fetch({
        url: 'broadCast/query/'+page+'/'+rows,
        method: 'post',
        data
    });
  }

//获取电板列表
export function listPanels(schoolId,deviceId) {
    const data = {
        schoolId,
        deviceId
    };
    return fetch({
        url: 'broadCast/listPanels',
        method: 'post',
        data
    });
  }
//删除电板
export function deletePanels(relayId) {
    const data = {
        relayId
    };
    return fetch({
        url: 'broadCast/deletePanels',
        method: 'post',
        data
    });
  }
//添加电板
export function addPanels(relayType,schoolId,deviceId,relayName,relayNumber) {
    const data = {
        relayType,
        schoolId,
        deviceId,
        relayName,
        relayNumber
    };
    return fetch({
        url: 'broadCast/addPanels',
        method: 'post',
        data
    });
  }
//获取石榴仔设备编号列表
export function listNumber(schoolId,deviceId) {
    const data = {
        schoolId,
        deviceId
    };
    return fetch({
        url: 'broadCast/listNumber',
        method: 'post',
        data
    });
  }
//重置
export function getReset(mapId) {
    const data = {
        mapId
    };
    return fetch({
        url: 'broadCast/getReset',
        method: 'post',
        data
    });
  }
//配置
export function getConfig(relayId,channelNumber,classId) {
    const data = {
        relayId,
        channelNumber,
        classId
    };
    return fetch({
        url: 'broadCast/getConfig',
        method: 'post',
        data
    });
  }
//获取配置电板列表
export function listPanelsByConfig(schoolId,deviceId) {
    const data = {
        schoolId,
        deviceId
    };
    return fetch({
        url: 'broadCast/listPanelsByConfig',
        method: 'post',
        data
    });
  }
//获取电板未绑定继电器编号列表
export function listChannelNumberByPanels(relayId,relayType) {
    const data = {
        relayId,
        relayType
    };
    return fetch({
        url: 'broadCast/listChannelNumberByPanels',
        method: 'post',
        data
    });
  }